
namespace DownloadBook {
    /// <summary>
    /// 唯一实例基类
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class UniqueInstanceBase<T> where T: new(){

        private static T s_Instance;
        public static T instance {
            get {
                lock (typeof(T)) {
                    if(s_Instance == null) {
                        s_Instance = new T();
                    }
                }
                return s_Instance;
            }
        }

        protected UniqueInstanceBase() {
            
        }
        
    }
}